using UnityEngine;

namespace CinemaDirector
{
	public class GGTweenTransformBase : CinemaGlobalAction
	{
		public Transform trans;

		public Vector3 from;

		public Vector3 to;

		public Interpolate.EaseType easeType;

		protected Vector3 cachedProperty;

		public virtual void SetProperty(Vector3 newPropertyValue)
		{
		}

		public virtual Vector3 GetProperty()
		{
			return Vector3.zero;
		}

		public virtual Vector3 GetFrom()
		{
			return from;
		}

		public virtual Vector3 GetTo()
		{
			return to;
		}

		public override void Trigger()
		{
			SetProperty(GetFrom());
		}

		public override void Initialize()
		{
			cachedProperty = GetProperty();
		}

		public override void Stop()
		{
			if (!Application.isPlaying)
			{
				SetProperty(cachedProperty);
			}
		}

		public override void ReverseTrigger()
		{
			End();
		}

		public override void End()
		{
			SetProperty(GetTo());
		}

		public override void ReverseEnd()
		{
			Trigger();
		}

		public override void UpdateTime(float time, float deltaTime)
		{
			Vector3 property = Interpolate.Ease(Interpolate.Ease(easeType), GetFrom(), GetTo() - GetFrom(), time, Mathf.Max(0.01f, base.Duration));
			SetProperty(property);
		}

		public override void SetTime(float time, float deltaTime)
		{
			if (!(time < 0f) && !(time > base.Duration))
			{
				UpdateTime(time, deltaTime);
			}
		}
	}
}
